#  密码长度判断
def passwd_judge1(passwd:str, grade):
    if len(passwd) < 8:
        advice.append("你的密码长度小于8，请重试!")
    else:
        grade += 1
    return grade
# 数字，字母，特殊字符的判断
result = [0, 0, 0, 0]
def passwd_judge2(passwd:str):
    for i in passwd:
        if sum(result) >=3:
            break
        else:
            if i.isupper():
                result[0] = 1
            elif i.islower():
                result[1] = 1
            elif i.isdigit():
                result[2] = 1
            else:
                result[3] = 1
    return result
# 重复子串判断
def passwd_judge3():
    global grade1
    grade1 = 0
    for a in range(len(passwd)):
        if passwd.count(passwd[a:a + 3]) >=2:
            advice.append("你的密码有长度超过或等于3的子串重复！")
            break
        else:
            grade1 =1
    return grade1

passwd = input("请输入密码：")
grade = 2
advice = []
grade = passwd_judge1(passwd,grade)
grade1 = passwd_judge3()
if grade1 == 1:
    grade +=1
result1 = passwd_judge2(passwd)
if sum(result1) < 3:
    info = ["你的密码需要包括大、小写字母.数字.其它符号,以上四种至少三种"]
    print(f"您的密码等级为:{grade},提示:{advice+info}")
else:
    grade +=1
    print(f"您的密码等级为:{grade},提示:{advice}")

